<?php require_once '../config.php';?>
<?php require_once '../dao/dao_db.php';?>
<?php require_once '../dao/dao_thesis.php';?>
<?php 
	session_start();
	session_cache_limiter("private");
	if(!isset($_SESSION['userid'])||$_SESSION['level']!=STUDENT){
		header("LOCATION:../error.php?errcode=2");
	}
	if (trim($_POST['thesistitle'])==''||trim($_POST['publishplace'])==''||$_POST['publishdate']==''||trim($_POST['searchcode'])==''){
		header("LOCATION:../create_thesis.php?errcode=1");
	}else{
		save_thesis($_SESSION['userid'],trim($_POST['thesistitle']),trim($_POST['publishplace']),$_POST['publishdate'],trim($_POST['searchcode']));
		header("LOCATION:../create_thesis.php?msgcode=1");
	}
?>